<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'stockgroup-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'groupname'); ?>
		<?php echo $form->textField($model,'groupname',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo $form->error($model,'groupname'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'idundergroup'); ?>
                <?php
                    $models = Stockgroup::model()->findAll(array('order' => 'groupname'));

                    // format models as $key=>$value with listData
                    $list = CHtml::listData($models, 'idstockgroup', 'groupname');
                    echo CHtml::activeDropDownList($model, 'idundergroup', $list, array('empty' => '(Select a Stockgroup'));
                ?>
            
		<?php //echo $form->textField($model,'idundergroup',array('size'=>10,'maxlength'=>10)); ?>
		<?php //echo $form->error($model,'idundergroup'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->